<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Test2::API::Instance - Object used by Test2::API under the hood - Perldoc Browser</title>
    <link rel="search" href="https://perldoc.perl.org/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser">
    <link rel="canonical" href="https://perldoc.perl.org/Test2::API::Instance">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" />
    <style>
      body {
        background: #f4f4f5;
        color: #020202;
      }
      .navbar-dark {
        background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0);
        background-repeat: repeat-x;
      }
      .navbar-dark .navbar-nav .nav-link,
      .navbar-dark .navbar-nav .nav-link:focus { color: #fff }
      .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 }
      #wrapperlicious {
        margin: 0 auto;
        font: 0.9em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: normal;
        line-height: 1.5em;
        margin: 0;
        padding: 0;
      }
      #wrapperlicious h1 { font-size: 1.5em }
      #wrapperlicious h2 { font-size: 1.3em }
      #wrapperlicious h3 { font-size: 1.1em }
      #wrapperlicious h4 { font-size: 0.9em }
      #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3,
      #wrapperlicious h4, #wrapperlicious dt {
        color: #020202;
        margin-top: 1em;
        margin-bottom: 1em;
        position: relative;
        font-weight: bold;
      }
      #wrapperlicious a { color: inherit; text-decoration: underline }
      #wrapperlicious #toc { text-decoration: none }
      #wrapperlicious a:hover { color: #2a2a2a }
      #wrapperlicious a img { border: 0 }
      #wrapperlicious :not(pre) > code {
        color: inherit;
        background-color: rgba(0, 0, 0, 0.04);
        border-radius: 3px;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        padding: 0.3em;
      }
      #wrapperlicious dd {
        margin: 0;
        margin-left: 2em;
      }
      #wrapperlicious dt {
        color: #2a2a2a;
        font-weight: bold;
        margin-left: 0.9em;
      }
      #wrapperlicious p {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious li > p {
        margin-bottom: 0;
        margin-top: 0;
      }
      #wrapperlicious pre {
        border: 1px solid #c1c1c1;
        border-radius: 3px;
        font: 100% Consolas, Menlo, Monaco, monospace;
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious pre > code {
        display: block;
        background-color: #f6f6f6;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        line-height: 1.5em;
        text-align: left;
        white-space: pre;
        padding: 1em;
      }
      #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious ul {
        list-style-type: square;
      }
      #wrapperlicious ul ul {
        margin-bottom: 0px;
        margin-top: 0px;
      }
      #footer {
        font-size: 0.8em;
        padding-top: 0.5em;
        text-align: center;
      }
      #more {
        display: inline;
        font-size: 0.8em;
      }
      #perldocdiv {
        background-color: #fff;
        border: 1px solid #c1c1c1;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        margin-left: auto;
        margin-right: auto;
        padding: 3em;
        padding-top: 1em;
        max-width: 960px;
      }
      #moduleversion { float: right }
      #wrapperlicious .leading-notice {
        font-style: italic;
        padding-left: 1em;
        margin-top: 1em;
        margin-bottom: 1em;
      }
      #wrapperlicious .permalink {
        display: none;
        left: -0.75em;
        position: absolute;
        padding-right: 0.25em;
        text-decoration: none;
      }
      #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink,
      #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink,
      #wrapperlicious dt:hover .permalink {
        display: block;
      }
    </style>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-KVNWBNT5FB');
      gtag('config', 'UA-50555-3');
    </script>
  </head>
  <body>
    <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="https://perldoc.perl.org/">Perldoc Browser</a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Test2::API::Instance.html#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.35.0</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-stable">
          <a class="dropdown-item" href="https://perldoc.perl.org/Test2::API::Instance">Latest</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.2/Test2::API::Instance">5.38.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.1/Test2::API::Instance">5.38.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0/Test2::API::Instance">5.38.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.3/Test2::API::Instance">5.36.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.2/Test2::API::Instance">5.36.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.1/Test2::API::Instance">5.36.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.0/Test2::API::Instance">5.36.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.3/Test2::API::Instance">5.34.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.2/Test2::API::Instance">5.34.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.1/Test2::API::Instance">5.34.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.0/Test2::API::Instance">5.34.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.1/Test2::API::Instance">5.32.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.0/Test2::API::Instance">5.32.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.3/Test2::API::Instance">5.30.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.2/Test2::API::Instance">5.30.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.1/Test2::API::Instance">5.30.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.0/Test2::API::Instance">5.30.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.3/Test2::API::Instance">5.28.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.2/Test2::API::Instance">5.28.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.1/Test2::API::Instance">5.28.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.0/Test2::API::Instance">5.28.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.3/Test2::API::Instance">5.26.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.2/Test2::API::Instance">5.26.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.1/Test2::API::Instance">5.26.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.0/Test2::API::Instance">5.26.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.4/Test2::API::Instance">5.24.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.3/Test2::API::Instance">5.24.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.2/Test2::API::Instance">5.24.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.1/Test2::API::Instance">5.24.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.0/Test2::API::Instance">5.24.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.4/Test2::API::Instance">5.22.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.3/Test2::API::Instance">5.22.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.2/Test2::API::Instance">5.22.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.1/Test2::API::Instance">5.22.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.0/Test2::API::Instance">5.22.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.3/Test2::API::Instance">5.20.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.2/Test2::API::Instance">5.20.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.1/Test2::API::Instance">5.20.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.0/Test2::API::Instance">5.20.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.4/Test2::API::Instance">5.18.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.3/Test2::API::Instance">5.18.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.2/Test2::API::Instance">5.18.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.1/Test2::API::Instance">5.18.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.0/Test2::API::Instance">5.18.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.3/Test2::API::Instance">5.16.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.2/Test2::API::Instance">5.16.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.1/Test2::API::Instance">5.16.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.0/Test2::API::Instance">5.16.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.4/Test2::API::Instance">5.14.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.3/Test2::API::Instance">5.14.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.2/Test2::API::Instance">5.14.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.1/Test2::API::Instance">5.14.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.0/Test2::API::Instance">5.14.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.5/Test2::API::Instance">5.12.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.4/Test2::API::Instance">5.12.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.3/Test2::API::Instance">5.12.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.2/Test2::API::Instance">5.12.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.1/Test2::API::Instance">5.12.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.0/Test2::API::Instance">5.12.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.1/Test2::API::Instance">5.10.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.0/Test2::API::Instance">5.10.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.9/Test2::API::Instance">5.8.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.8/Test2::API::Instance">5.8.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.7/Test2::API::Instance">5.8.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.6/Test2::API::Instance">5.8.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.5/Test2::API::Instance">5.8.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.4/Test2::API::Instance">5.8.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.3/Test2::API::Instance">5.8.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.2/Test2::API::Instance">5.8.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.1/Test2::API::Instance">5.8.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.0/Test2::API::Instance">5.8.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.2/Test2::API::Instance">5.6.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.1/Test2::API::Instance">5.6.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.0/Test2::API::Instance">5.6.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_04/Test2::API::Instance">5.005_04</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_03/Test2::API::Instance">5.005_03</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_02/Test2::API::Instance">5.005_02</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_01/Test2::API::Instance">5.005_01</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005/Test2::API::Instance">5.005</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Test2::API::Instance.html#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-dev">
          <a class="dropdown-item" href="https://perldoc.perl.org/blead/Test2::API::Instance">blead</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.6/Test2::API::Instance">5.39.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.5/Test2::API::Instance">5.39.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.4/Test2::API::Instance">5.39.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.3/Test2::API::Instance">5.39.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.2/Test2::API::Instance">5.39.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.1/Test2::API::Instance">5.39.1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC2/Test2::API::Instance">5.38.0-RC2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC1/Test2::API::Instance">5.38.0-RC1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.11/Test2::API::Instance">5.37.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.10/Test2::API::Instance">5.37.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.9/Test2::API::Instance">5.37.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.8/Test2::API::Instance">5.37.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.7/Test2::API::Instance">5.37.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.6/Test2::API::Instance">5.37.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.5/Test2::API::Instance">5.37.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.4/Test2::API::Instance">5.37.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.3/Test2::API::Instance">5.37.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.2/Test2::API::Instance">5.37.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.1/Test2::API::Instance">5.37.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.0/Test2::API::Instance">5.37.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.11/Test2::API::Instance">5.35.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.10/Test2::API::Instance">5.35.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.9/Test2::API::Instance">5.35.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.8/Test2::API::Instance">5.35.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.7/Test2::API::Instance">5.35.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.6/Test2::API::Instance">5.35.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.5/Test2::API::Instance">5.35.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.4/Test2::API::Instance">5.35.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.3/Test2::API::Instance">5.35.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.2/Test2::API::Instance">5.35.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.1/Test2::API::Instance">5.35.1</a>
          <a class="dropdown-item active" href="./Test2::API::Instance.html">5.35.0</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Test2::API::Instance.html#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-nav">
          <a class="dropdown-item" href="perl.html">Perl</a>
          <a class="dropdown-item" href="perlintro.html">Intro</a>
          <a class="dropdown-item" href="perl.html#Tutorials">Tutorials</a>
          <a class="dropdown-item" href="perlfaq.html">FAQs</a>
          <a class="dropdown-item" href="perl.html#Reference-Manual">Reference</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlop.html">Operators</a>
          <a class="dropdown-item" href="functions.html">Functions</a>
          <a class="dropdown-item" href="variables.html">Variables</a>
          <a class="dropdown-item" href="modules.html">Modules</a>
          <a class="dropdown-item" href="perlutil.html">Utilities</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlcommunity.html">Community</a>
          <a class="dropdown-item" href="perlhist.html">History</a>
        </div>
      </li>
    </ul>
    <ul class="navbar-nav">
      <script>
        function set_expand (expand) {
          var perldocdiv = document.getElementById('perldocdiv');
          var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width');
          var expanded = (width == '' || width == 'none') ? true : false;
          if (expand === null) {
            expand = !expanded;
          }
          if ((expand && !expanded) || (!expand && expanded)) {
            perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px');
            var button_classlist = document.getElementById('content-expand-button').classList;
            if (expand) {
              button_classlist.add('btn-light');
              button_classlist.remove('btn-outline-light');
            } else {
              button_classlist.add('btn-outline-light');
              button_classlist.remove('btn-light');
            }
          }
          return expand;
        }
        function toggle_expand () {
          var expand = set_expand(null);
          document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC';
        }
        function read_expand () {
          return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 });
        }
        if (document.readyState === 'loading') {
          document.addEventListener('DOMContentLoaded', function () {
            if (read_expand()) {
              set_expand(true);
            }
          });
        } else if (read_expand()) {
          set_expand(true);
        }
      </script>
      <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-2" onclick="toggle_expand()">Expand</button>
    <ul>
    <form class="form-inline" method="get" action="https://perldoc.perl.org/5.35.0/search">
      <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search">
    </form>
  </div>
</nav>

    <div id="wrapperlicious" class="container-fluid">
      <div id="perldocdiv">
        <div id="links">
          <a href="./Test2::API::Instance.html">Test2::API::Instance</a>
          <div id="more">
            (<a href="./Test2::API::Instance.txt">source</a>,
            <a href="https://metacpan.org/pod/Test2::API::Instance">CPAN</a>)
          </div>
            <div id="moduleversion">version 1.302183</div>
        </div>
        <div class="leading-notice">
          You are viewing the version of this documentation from Perl 5.35.0.
            This is a development version of Perl.
        </div>
        <h1><a id="toc">CONTENTS</a></h1>
                  <ul>
              <li>
                <a class="text-decoration-none" href="./Test2::API::Instance.html#NAME">NAME</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API::Instance.html#DESCRIPTION">DESCRIPTION</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API::Instance.html#SYNOPSIS">SYNOPSIS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API::Instance.html#SOURCE">SOURCE</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API::Instance.html#MAINTAINERS">MAINTAINERS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API::Instance.html#AUTHORS">AUTHORS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API::Instance.html#COPYRIGHT">COPYRIGHT</a>
              </li>
          </ul>

      <h1 id="NAME"><a class="permalink" href="./Test2::API::Instance.html#NAME">#</a>NAME</h1>

<p>Test2::API::Instance - Object used by Test2::API under the hood</p>

<h1 id="DESCRIPTION"><a class="permalink" href="./Test2::API::Instance.html#DESCRIPTION">#</a>DESCRIPTION</h1>

<p>This object encapsulates the global shared state tracked by <a href="Test2.html">Test2</a>. A single global instance of this package is stored (and obscured) by the <a href="./Test2::API.html">Test2::API</a> package.</p>

<p>There is no reason to directly use this package. This package is documented for completeness. This package can change, or go away completely at any time. Directly using, or monkeypatching this package is not supported in any way shape or form.</p>

<h1 id="SYNOPSIS"><a class="permalink" href="./Test2::API::Instance.html#SYNOPSIS">#</a>SYNOPSIS</h1>

<pre><code>use Test2::API::Instance;

my $obj = Test2::API::Instance-&gt;new;</code></pre>

<dl>

<dt id="$pid-=-$obj-&gt;pid"><a class="permalink" href="./Test2::API::Instance.html#$pid-=-$obj-%3Epid">#</a><a id="pid-obj-pid"></a>$pid = $obj-&gt;pid</dt>
<dd>

<p>PID of this instance.</p>

</dd>
<dt id="$obj-&gt;tid"><a class="permalink" href="./Test2::API::Instance.html#$obj-%3Etid">#</a><a id="tid"></a><a id="obj-tid"></a>$obj-&gt;tid</dt>
<dd>

<p>Thread ID of this instance.</p>

</dd>
<dt id="$obj-&gt;reset()"><a class="permalink" href="./Test2::API::Instance.html#$obj-%3Ereset()">#</a><a id="reset"></a><a id="obj-reset"></a>$obj-&gt;reset()</dt>
<dd>

<p>Reset the object to defaults.</p>

</dd>
<dt id="$obj-&gt;load()"><a class="permalink" href="./Test2::API::Instance.html#$obj-%3Eload()">#</a><a id="load"></a><a id="obj-load"></a>$obj-&gt;load()</dt>
<dd>

<p>Set the internal state to loaded, and run and stored post-load callbacks.</p>

</dd>
<dt id="$bool-=-$obj-&gt;loaded"><a class="permalink" href="./Test2::API::Instance.html#$bool-=-$obj-%3Eloaded">#</a><a id="bool-obj-loaded"></a>$bool = $obj-&gt;loaded</dt>
<dd>

<p>Check if the state is set to loaded.</p>

</dd>
<dt id="$arrayref-=-$obj-&gt;post_load_callbacks"><a class="permalink" href="./Test2::API::Instance.html#$arrayref-=-$obj-%3Epost_load_callbacks">#</a><a id="arrayref-obj-post_load_callbacks"></a>$arrayref = $obj-&gt;post_load_callbacks</dt>
<dd>

<p>Get the post-load callbacks.</p>

</dd>
<dt id="$obj-&gt;add_post_load_callback(sub-{-...-})"><a class="permalink" href="./Test2::API::Instance.html#$obj-%3Eadd_post_load_callback(sub-%7B-...-%7D)">#</a><a id="add_post_load_callback"></a><a id="obj-add_post_load_callback-sub"></a>$obj-&gt;add_post_load_callback(sub { ... })</dt>
<dd>

<p>Add a post-load callback. If <code>load()</code> has already been called then the callback will be immediately executed. If <code>load()</code> has not been called then the callback will be stored and executed later when <code>load()</code> is called.</p>

</dd>
<dt id="$hashref-=-$obj-&gt;contexts()"><a class="permalink" href="./Test2::API::Instance.html#$hashref-=-$obj-%3Econtexts()">#</a><a id="hashref-obj-contexts"></a>$hashref = $obj-&gt;contexts()</dt>
<dd>

<p>Get a hashref of all active contexts keyed by hub id.</p>

</dd>
<dt id="$arrayref-=-$obj-&gt;context_acquire_callbacks"><a class="permalink" href="./Test2::API::Instance.html#$arrayref-=-$obj-%3Econtext_acquire_callbacks">#</a><a id="arrayref-obj-context_acquire_callbacks"></a>$arrayref = $obj-&gt;context_acquire_callbacks</dt>
<dd>

<p>Get all context acquire callbacks.</p>

</dd>
<dt id="$arrayref-=-$obj-&gt;context_init_callbacks"><a class="permalink" href="./Test2::API::Instance.html#$arrayref-=-$obj-%3Econtext_init_callbacks">#</a><a id="arrayref-obj-context_init_callbacks"></a>$arrayref = $obj-&gt;context_init_callbacks</dt>
<dd>

<p>Get all context init callbacks.</p>

</dd>
<dt id="$arrayref-=-$obj-&gt;context_release_callbacks"><a class="permalink" href="./Test2::API::Instance.html#$arrayref-=-$obj-%3Econtext_release_callbacks">#</a><a id="arrayref-obj-context_release_callbacks"></a>$arrayref = $obj-&gt;context_release_callbacks</dt>
<dd>

<p>Get all context release callbacks.</p>

</dd>
<dt id="$arrayref-=-$obj-&gt;pre_subtest_callbacks"><a class="permalink" href="./Test2::API::Instance.html#$arrayref-=-$obj-%3Epre_subtest_callbacks">#</a><a id="arrayref-obj-pre_subtest_callbacks"></a>$arrayref = $obj-&gt;pre_subtest_callbacks</dt>
<dd>

<p>Get all pre-subtest callbacks.</p>

</dd>
<dt id="$obj-&gt;add_context_init_callback(sub-{-...-})"><a class="permalink" href="./Test2::API::Instance.html#$obj-%3Eadd_context_init_callback(sub-%7B-...-%7D)">#</a><a id="add_context_init_callback"></a><a id="obj-add_context_init_callback-sub"></a>$obj-&gt;add_context_init_callback(sub { ... })</dt>
<dd>

<p>Add a context init callback. Subs are called every time a context is created. Subs get the newly created context as their only argument.</p>

</dd>
<dt id="$obj-&gt;add_context_release_callback(sub-{-...-})"><a class="permalink" href="./Test2::API::Instance.html#$obj-%3Eadd_context_release_callback(sub-%7B-...-%7D)">#</a><a id="add_context_release_callback"></a><a id="obj-add_context_release_callback-sub"></a>$obj-&gt;add_context_release_callback(sub { ... })</dt>
<dd>

<p>Add a context release callback. Subs are called every time a context is released. Subs get the released context as their only argument. These callbacks should not call release on the context.</p>

</dd>
<dt id="$obj-&gt;add_pre_subtest_callback(sub-{-...-})"><a class="permalink" href="./Test2::API::Instance.html#$obj-%3Eadd_pre_subtest_callback(sub-%7B-...-%7D)">#</a><a id="add_pre_subtest_callback"></a><a id="obj-add_pre_subtest_callback-sub"></a>$obj-&gt;add_pre_subtest_callback(sub { ... })</dt>
<dd>

<p>Add a pre-subtest callback. Subs are called every time a subtest is going to be run. Subs get the subtest name, coderef, and any arguments.</p>

</dd>
<dt id="$obj-&gt;set_exit()"><a class="permalink" href="./Test2::API::Instance.html#$obj-%3Eset_exit()">#</a><a id="set_exit"></a><a id="obj-set_exit"></a>$obj-&gt;set_exit()</dt>
<dd>

<p>This is intended to be called in an <code>END { ... }</code> block. This will look at test state and set $?. This will also call any end callbacks, and wait on child processes/threads.</p>

</dd>
<dt id="$obj-&gt;set_ipc_pending($val)"><a class="permalink" href="./Test2::API::Instance.html#$obj-%3Eset_ipc_pending($val)">#</a><a id="set_ipc_pending"></a><a id="obj-set_ipc_pending-val"></a>$obj-&gt;set_ipc_pending($val)</dt>
<dd>

<p>Tell other processes and threads there is a pending event. <code>$val</code> should be a unique value no other thread/process will generate.</p>

<p><b>Note:</b> This will also make the current process see a pending event.</p>

</dd>
<dt id="$pending-=-$obj-&gt;get_ipc_pending()"><a class="permalink" href="./Test2::API::Instance.html#$pending-=-$obj-%3Eget_ipc_pending()">#</a><a id="pending-obj-get_ipc_pending"></a>$pending = $obj-&gt;get_ipc_pending()</dt>
<dd>

<p>This returns -1 if it is not possible to know.</p>

<p>This returns 0 if there are no pending events.</p>

<p>This returns 1 if there are pending events.</p>

</dd>
<dt id="$timeout-=-$obj-&gt;ipc_timeout;"><a class="permalink" href="./Test2::API::Instance.html#$timeout-=-$obj-%3Eipc_timeout;">#</a><a id="timeout-obj-ipc_timeout"></a>$timeout = $obj-&gt;ipc_timeout;</dt>
<dd>

</dd>
<dt id="$obj-&gt;set_ipc_timeout($timeout);"><a class="permalink" href="./Test2::API::Instance.html#$obj-%3Eset_ipc_timeout($timeout);">#</a><a id="set_ipc_timeout"></a><a id="obj-set_ipc_timeout-timeout"></a>$obj-&gt;set_ipc_timeout($timeout);</dt>
<dd>

<p>How long to wait for child processes and threads before aborting.</p>

</dd>
<dt id="$drivers-=-$obj-&gt;ipc_drivers"><a class="permalink" href="./Test2::API::Instance.html#$drivers-=-$obj-%3Eipc_drivers">#</a><a id="drivers-obj-ipc_drivers"></a>$drivers = $obj-&gt;ipc_drivers</dt>
<dd>

<p>Get the list of IPC drivers.</p>

</dd>
<dt id="$obj-&gt;add_ipc_driver($DRIVER_CLASS)"><a class="permalink" href="./Test2::API::Instance.html#$obj-%3Eadd_ipc_driver($DRIVER_CLASS)">#</a><a id="add_ipc_driver"></a><a id="obj-add_ipc_driver-DRIVER_CLASS"></a>$obj-&gt;add_ipc_driver($DRIVER_CLASS)</dt>
<dd>

<p>Add an IPC driver to the list. The most recently added IPC driver will become the global one during initialization. If a driver is added after initialization has occurred a warning will be generated:</p>

<pre><code>&quot;IPC driver $driver loaded too late to be used as the global ipc driver&quot;</code></pre>

</dd>
<dt id="$bool-=-$obj-&gt;ipc_polling"><a class="permalink" href="./Test2::API::Instance.html#$bool-=-$obj-%3Eipc_polling">#</a><a id="bool-obj-ipc_polling"></a>$bool = $obj-&gt;ipc_polling</dt>
<dd>

<p>Check if polling is enabled.</p>

</dd>
<dt id="$obj-&gt;enable_ipc_polling"><a class="permalink" href="./Test2::API::Instance.html#$obj-%3Eenable_ipc_polling">#</a><a id="enable_ipc_polling"></a><a id="obj-enable_ipc_polling"></a>$obj-&gt;enable_ipc_polling</dt>
<dd>

<p>Turn on polling. This will cull events from other processes and threads every time a context is created.</p>

</dd>
<dt id="$obj-&gt;disable_ipc_polling"><a class="permalink" href="./Test2::API::Instance.html#$obj-%3Edisable_ipc_polling">#</a><a id="disable_ipc_polling"></a><a id="obj-disable_ipc_polling"></a>$obj-&gt;disable_ipc_polling</dt>
<dd>

<p>Turn off IPC polling.</p>

</dd>
<dt id="$bool-=-$obj-&gt;no_wait"><a class="permalink" href="./Test2::API::Instance.html#$bool-=-$obj-%3Eno_wait">#</a><a id="bool-obj-no_wait"></a>$bool = $obj-&gt;no_wait</dt>
<dd>

</dd>
<dt id="$bool-=-$obj-&gt;set_no_wait($bool)"><a class="permalink" href="./Test2::API::Instance.html#$bool-=-$obj-%3Eset_no_wait($bool)">#</a><a id="bool-obj-set_no_wait-bool"></a>$bool = $obj-&gt;set_no_wait($bool)</dt>
<dd>

<p>Get/Set no_wait. This option is used to turn off process/thread waiting at exit.</p>

</dd>
<dt id="$arrayref-=-$obj-&gt;exit_callbacks"><a class="permalink" href="./Test2::API::Instance.html#$arrayref-=-$obj-%3Eexit_callbacks">#</a><a id="arrayref-obj-exit_callbacks"></a>$arrayref = $obj-&gt;exit_callbacks</dt>
<dd>

<p>Get the exit callbacks.</p>

</dd>
<dt id="$obj-&gt;add_exit_callback(sub-{-...-})"><a class="permalink" href="./Test2::API::Instance.html#$obj-%3Eadd_exit_callback(sub-%7B-...-%7D)">#</a><a id="add_exit_callback"></a><a id="obj-add_exit_callback-sub"></a>$obj-&gt;add_exit_callback(sub { ... })</dt>
<dd>

<p>Add an exit callback. This callback will be called by <code>set_exit()</code>.</p>

</dd>
<dt id="$bool-=-$obj-&gt;finalized"><a class="permalink" href="./Test2::API::Instance.html#$bool-=-$obj-%3Efinalized">#</a><a id="bool-obj-finalized"></a>$bool = $obj-&gt;finalized</dt>
<dd>

<p>Check if the object is finalized. Finalization happens when either <code>ipc()</code>, <code>stack()</code>, or <code>format()</code> are called on the object. Once finalization happens these fields are considered unchangeable (not enforced here, enforced by <a href="Test2.html">Test2</a>).</p>

</dd>
<dt id="$ipc-=-$obj-&gt;ipc"><a class="permalink" href="./Test2::API::Instance.html#$ipc-=-$obj-%3Eipc">#</a><a id="ipc-obj-ipc"></a>$ipc = $obj-&gt;ipc</dt>
<dd>

<p>Get the one true IPC instance.</p>

</dd>
<dt id="$obj-&gt;ipc_disable"><a class="permalink" href="./Test2::API::Instance.html#$obj-%3Eipc_disable">#</a><a id="ipc_disable"></a><a id="obj-ipc_disable"></a>$obj-&gt;ipc_disable</dt>
<dd>

<p>Turn IPC off</p>

</dd>
<dt id="$bool-=-$obj-&gt;ipc_disabled"><a class="permalink" href="./Test2::API::Instance.html#$bool-=-$obj-%3Eipc_disabled">#</a><a id="bool-obj-ipc_disabled"></a>$bool = $obj-&gt;ipc_disabled</dt>
<dd>

<p>Check if IPC is disabled</p>

</dd>
<dt id="$stack-=-$obj-&gt;stack"><a class="permalink" href="./Test2::API::Instance.html#$stack-=-$obj-%3Estack">#</a><a id="stack-obj-stack"></a>$stack = $obj-&gt;stack</dt>
<dd>

<p>Get the one true hub stack.</p>

</dd>
<dt id="$formatter-=-$obj-&gt;formatter"><a class="permalink" href="./Test2::API::Instance.html#$formatter-=-$obj-%3Eformatter">#</a><a id="formatter-obj-formatter"></a>$formatter = $obj-&gt;formatter</dt>
<dd>

<p>Get the global formatter. By default this is the <code>&#39;Test2::Formatter::TAP&#39;</code> package. This could be any package that implements the <code>write()</code> method. This can also be an instantiated object.</p>

</dd>
<dt id="$bool-=-$obj-&gt;formatter_set()"><a class="permalink" href="./Test2::API::Instance.html#$bool-=-$obj-%3Eformatter_set()">#</a><a id="bool-obj-formatter_set"></a>$bool = $obj-&gt;formatter_set()</dt>
<dd>

<p>Check if a formatter has been set.</p>

</dd>
<dt id="$obj-&gt;add_formatter($class)"><a class="permalink" href="./Test2::API::Instance.html#$obj-%3Eadd_formatter($class)">#</a><a id="add_formatter"></a><a id="obj-add_formatter-class"></a>$obj-&gt;add_formatter($class)</dt>
<dd>

</dd>
<dt id="$obj-&gt;add_formatter($obj)"><a class="permalink" href="./Test2::API::Instance.html#$obj-%3Eadd_formatter($obj)">#</a><a id="add_formatter1"></a><a id="obj-add_formatter-obj"></a>$obj-&gt;add_formatter($obj)</dt>
<dd>

<p>Add a formatter. The most recently added formatter will become the global one during initialization. If a formatter is added after initialization has occurred a warning will be generated:</p>

<pre><code>&quot;Formatter $formatter loaded too late to be used as the global formatter&quot;</code></pre>

</dd>
<dt id="$obj-&gt;set_add_uuid_via(sub-{-...-})"><a class="permalink" href="./Test2::API::Instance.html#$obj-%3Eset_add_uuid_via(sub-%7B-...-%7D)">#</a><a id="set_add_uuid_via"></a><a id="obj-set_add_uuid_via-sub"></a>$obj-&gt;set_add_uuid_via(sub { ... })</dt>
<dd>

</dd>
<dt id="$sub-=-$obj-&gt;add_uuid_via()"><a class="permalink" href="./Test2::API::Instance.html#$sub-=-$obj-%3Eadd_uuid_via()">#</a><a id="sub-obj-add_uuid_via"></a>$sub = $obj-&gt;add_uuid_via()</dt>
<dd>

<p>This allows you to provide a UUID generator. If provided UUIDs will be attached to all events, hubs, and contexts. This is useful for storing, tracking, and linking these objects.</p>

<p>The sub you provide should always return a unique identifier. Most things will expect a proper UUID string, however nothing in Test2::API enforces this.</p>

<p>The sub will receive exactly 1 argument, the type of thing being tagged &#39;context&#39;, &#39;hub&#39;, or &#39;event&#39;. In the future additional things may be tagged, in which case new strings will be passed in. These are purely informative, you can (and usually should) ignore them.</p>

</dd>
</dl>

<h1 id="SOURCE"><a class="permalink" href="./Test2::API::Instance.html#SOURCE">#</a>SOURCE</h1>

<p>The source code repository for Test2 can be found at <i>http://github.com/Test-More/test-more/</i>.</p>

<h1 id="MAINTAINERS"><a class="permalink" href="./Test2::API::Instance.html#MAINTAINERS">#</a>MAINTAINERS</h1>

<dl>

<dt id="Chad-Granum"><a class="permalink" href="./Test2::API::Instance.html#Chad-Granum">#</a><a id="Chad-Granum-&lt;exodist@cpan.org&gt;"></a><a id="Chad"></a><a id="Chad-Granum-exodist-cpan.org"></a>Chad Granum &lt;exodist@cpan.org&gt;</dt>
<dd>

</dd>
</dl>

<h1 id="AUTHORS"><a class="permalink" href="./Test2::API::Instance.html#AUTHORS">#</a>AUTHORS</h1>

<dl>

<dt id="Chad-Granum1"><a class="permalink" href="./Test2::API::Instance.html#Chad-Granum1">#</a><a id="Chad-Granum-&lt;exodist@cpan.org&gt;1"></a><a id="Chad1"></a><a id="Chad-Granum-exodist-cpan.org1"></a>Chad Granum &lt;exodist@cpan.org&gt;</dt>
<dd>

</dd>
</dl>

<h1 id="COPYRIGHT"><a class="permalink" href="./Test2::API::Instance.html#COPYRIGHT">#</a>COPYRIGHT</h1>

<p>Copyright 2020 Chad Granum &lt;exodist@cpan.org&gt;.</p>

<p>This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p>

<p>See <i>http://dev.perl.org/licenses/</i></p>


      </div>
      <div id="footer">
        <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p>

<p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p>


      </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <script src="../highlight.pack.js"></script>
    <script>hljs.highlightAll();</script>
  </body>
</html>
